# PowerShell脚本 - 启动排班系统
Write-Host "正在启动排班系统..." -ForegroundColor Green

# 切换到应用目录
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location "$scriptPath\suanfa"

# 检查虚拟环境是否存在，如果不存在则创建
if (-not (Test-Path "venv")) {
    Write-Host "创建虚拟环境..." -ForegroundColor Yellow
    python -m venv venv
} else {
    Write-Host "虚拟环境已存在，跳过创建步骤" -ForegroundColor Cyan
}

# 激活虚拟环境
Write-Host "激活虚拟环境..." -ForegroundColor Yellow
& .\venv\Scripts\Activate.ps1

# 启动应用
Write-Host "启动应用..." -ForegroundColor Green
python run.py

# 保持窗口打开
Write-Host "按任意键退出..." -ForegroundColor Red
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") 